package com.example.yin.service.impl;

import com.example.yin.dao.SysLogMapper;
import com.example.yin.domain.SysLog;
import com.example.yin.service.SysLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysLogServiceImpl implements SysLogService {

    @Autowired
    private SysLogMapper sysLogMapper;

    @Override
    public boolean save(SysLog sysLog) {
        return  sysLogMapper.insertSelective(sysLog) > 0;
    }

    @Override
    public List<SysLog> getAll(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<SysLog> users = sysLogMapper.getAll();
        PageInfo<SysLog> pageInfo = new PageInfo<>(users);
        return pageInfo.getList();
    }
}
